function VarBeta = VarBetaCK(d)

       global priorvar Cbar1 Cbar0 Vtilde1 Vtilde0 Sigma1 Sigma0
       
      
       Ky1=Vtilde1(d==1, d==1) + diag(Sigma1(d==1));
       Ky0=Vtilde0(d==0, d==0) + diag(Sigma0(d==0));
       
             
VarBeta = priorvar - Cbar1(d==1) * (Ky1 \ Cbar1(d==1)') ...
                   - Cbar0(d==0) * (Ky0 \ Cbar0(d==0)');

            
return
